package org.sbbs.contoeth;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.web3j.protocol.Web3j;
import org.web3j.protocol.http.HttpService;

@SpringBootApplication
@Controller
public class Web3jApplication {

    public static void main(String[] args) {
        SpringApplication.run(Web3jApplication.class, args);
    }

    @RequestMapping({"/web3jVersion"})
    @ResponseBody
    public Object getVersion() {
//        Web3j web3j = Web3j.build(new HttpService("http://127.0.0.1:30303"));
        Web3j web3j = Web3j.build(new HttpService("http://127.0.0.1:8545"));
        return EthTools.getInfo(web3j);
    }
}
